﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Core.CacheService.Interface
{
    public interface ICache
    {
        /// <summary>
        /// 缓存一个值(无过期)
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="key"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        bool SetValue<T>(string key, T value);
        /// <summary>
        /// 缓存一个值
        /// </summary>
        /// <typeparam name="T">缓存的类型</typeparam>
        /// <param name="key">缓存的key</param>
        /// <param name="value">缓存的value</param>
        /// <param name="expires">过期时间</param>
        /// <returns></returns>
        bool SetValue<T>(string key, T value, int expires);
        T GetValue<T>(string key);
        object GetValue(string key, Type type);
        bool Contains(string key);
        bool TryGet<T>(string key, out T value);
        bool DeleteKey(string key);
        bool SetNotExists<T>(string key, T value, int expires);

    }
}
